<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.pro.bean.Groups " %>
<%@ page import="java.util.ArrayList;" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'groupTop.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">

	<link href="css/bootstrap.css" rel="stylesheet">
	<link rel="stylesheet" href="css/main.css">

	<script src="js/jquery.js"></script>
	<script src="js/bootstrap.min.js"></script>

	<title>分组管理表头</title>
	
<script type="text/javascript">

   $("document").ready(function(){
   $("#addGroup").click(function(){
    //var reg=new RegExp("^[0-9]{0,}\.?[0-9]{1,}$");
    if($("#groupnameInAdd").val()==""){
    alert("请输入组名！！！");
    //document.parent.frames("left").
    //左边页面刷新，而不是整个页面刷新
    
  }else if($("#groupnameInAdd").val()=="你好吗"){
     alert("组名重复，请重新输入！！！");
  }else if($("fathetgroupInAdd").val()==""){
  alert("请选择父组！！！");
  }else{
	 // alert("hhh"); 
     $.ajax({
    type:"post",
    url:"GroupServlet?&status=addJsp",
    data:$("#formtop").serialize(),
    success:function(datas){
    // alert(datas);
    //$("#divtop").html(datas);
    parent.frames["left"].location.reload();
    }    
    });
    }//else
}); 

   
   
});
</script>
</head>
<%
  ArrayList<Groups> gs = (ArrayList<Groups>) request.getAttribute("groups");


List list=(List)request.getSession().getAttribute("list");
Iterator it=list.iterator(); 
System.out.println(list.size());



%>
 

<body>
<form method="post" action="GroupServlet" name="formtop" target="left" id="formtop">
	<div id="divtop" style="background-color:#efefef;height:130px;width:900px">
		<div style="width:400px;float:left">
		    <p><font size="2"><strong>组信息</strong></font></p>
			<p><strong>自己所有名片 10个</strong></p>
			
			<p> 父组：<select style="width:200px" id="fathetgroupInAdd" name="fathetgroupInAdd">
				
        				<%
							while(it.hasNext()){
							Groups unit=(Groups)it.next();			
						%>
							<option value="<%=unit.getPrgroupid() %>"><%=unit.getPrgroupid() %></option>
						<%} %>

			</select> 
				</p>
			<p> 组名：<input type="text" id="groupnameInAdd" name="groupnameInAdd" />
			</p>
		</div>
		
		<div style="width:410px;float:right">
			<p><strong>其他用户名片：0个</strong></p>
			<p>
			<span>组说明: </span><input type="text" id="groupnoteInAdd"  name="groupnoteInAdd" />
			</p>
	
		<p align="right"> 
		    <button type="button"class="btn btn-info btn-xs"name="addGroup" id="addGroup">新建 </button>	
			<button type="reset"class="btn btn-info btn-xs"name="reset"id="reset">清空</button>
			</p> 
	      </div>
        </div>
	</form>
</body>
</html>
